package com.mpp.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mpp.model.entity.user.Patient;
import com.mpp.user.mapper.PatientMapper;
import com.mpp.user.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : PatientServiceImpl  //类名
 * @Description :   //描述
 * @Author : 易嵘  //作者
 * @Date: 2022-08-19 15:37  //时间
 */
@Service
public class PatientServiceImpl  extends ServiceImpl<PatientMapper, Patient> implements PatientService {

    @Autowired
    PatientMapper patientMapper;


    /**
     * 查询就诊人列表
     * @param userId 当前登录人id
     * @return 就诊人列表
     */
    @Override
    public List<Patient> findByUserId(Long userId){
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("userId",userId);
        List<Patient> list = baseMapper.selectList(queryWrapper);
        list.stream().forEach(item ->{
            //其他参数的封装
            this.packPatient(item);
        });

        return list;
    }

    /**
     * 其他参数封装
     * @param item 就诊人
     */
    private void packPatient(Patient item) {

    }
}
